%!TEX root = main.tex
\section{Management } \label{sec:manage}
The management system manipulates local KeyChain system and local NDNS database in order to provide services such as zone creation and zone delegation, which are essential to deploy the NDNS system.

%For manipulation of local NDNS database, specifically three different types of resource records will be created or removed according to different needs. They are listed in Table \ref{tab:retypes}.
NS RRs and ID-CERT RRs are the most common manipulated objects,
and they are essential since they are required to make NDNS bootstrap. NS is needed to maintain the hierarchical structure of the whole NDNS system. Zone delegation is achieved by inserting NS records containing information of the children zones to the parent zones such that a tree-like structure is constructed. ID-CERT is a must to establish the trust model illustrated in section 2.5. Typically, a zone in the NDNS system will keep records of its own Data Signing Key and its children's Key Signing Key.
% TXT is only used when a parent zone is to delegate a zone which is a leaf node in the hierarchy. 

%For manipulation of local KeyChain system, it only stores necessary information such as Data Signing Key to sign data and Key Signing Key to sign keys.

At the current version, it provides a tool set including ndns-add-rr, ndns-add-rr-from-file, ndns-create-zone, ndns-delete-zone, ndns-export-certificate, ndns-get-rr, ndns-list-all-zones, ndns-list-zone, and ndns-remove-rr. One can use the tool set to create zones, delegate zones and do corresponding cleanups. Detailed descriptions of the tool set and usages of the tool set are depicted in the following sections.

\subsection{Management Toolset}

\subsubsection{ndns-add-rr}
\begin{itemize}
\item Parameters: 1) zone; 2) label; 3) type; 4) content-type, NDNS type of the resource record; 5) content; 6) version; 7) ttl; 8) dsk, user selected dsk; 9) db, user selected database file. 
\item Effect: It adds a resource record set into the NDNS database with supplied parameters.
\end{itemize}

\subsubsection{ndns-add-rr-from-file}
\begin{itemize}
\item Parameters: 1) zone; 2) file; 3) ttl; 4) dsk; 5) db. 
\item Effect: It adds a resource record set into the NDNS database from a file. To be noticed, it automatically configures other fields of the resource record set from information provided in the file.
\end{itemize}

\subsubsection{ndns-create-zone}
\begin{itemize}
\item Parameters: 1) zone; 2) cacheTtl, ttl of records of the zone and its DSK ID-CERT; 3) certTtl, ttl of DSK and KSK certificates; 4) parent, the parent zone of the zone to be created; 5) dsk;  6) ksk, user selected ksk; 7) db. 
\item Effect: It creates a zone with supplied parameters. Specifically, it adds a zone record and its DSK ID-CERT into the NDNS database. Moreover, it creates a self-signed Key Signing Key and a Data Signing Key if not provided. 
\end{itemize}

\subsubsection{ndns-delete-zone}
\begin{itemize}
\item Parameters: 1) zone; 2) db. 
\item Effect: It deletes the zone by erasing zone record \& all related resource record sets in the NDNS database and removing the identity from KeyChain.
\end{itemize}

\subsubsection{ndns-export-certificate}
\begin{itemize}
\item Parameters: 1) certName, name of the certificate; 2) output, output path of the to be export certificate; 3) db. 
\item Effect: It outputs the target certificate either from KeyChain or from the NDNS database.
\end{itemize}

\subsubsection{ndns-get-rr}
\begin{itemize}
\item Parameters: 1) zone; 2) label; 3) type; 4) db. 
\item Effect: It outputs the raw format of the target resource record set.
\end{itemize}

\subsubsection{ndns-list-all-zones}
\begin{itemize}
\item Parameters: 1) db. 
\item Effect: It outputs all zone records from the NDNS database.
\end{itemize}

\subsubsection{ndns-list-zone}
\begin{itemize}
\item Parameters: 1) zone; 2) printRaw, flag to print resource record set's raw content; 4) db. 
\item Effect: It outputs all resource record sets of the target zone.
\end{itemize}

\subsubsection{ndns-remove-rr}
\begin{itemize}
\item Parameters: 1) zone; 2) label; 3) type; 4) db. 
\item Effect: It removes the target resource record set from the NDNS database.
\end{itemize}

\subsection{Usages}
In this section, two typical usages of the management toolset are described. They are zone creation and zone delegation.

\subsubsection{Zone Creation}
A normal zone can be easily created by using ndns-create-zone with needed parameters. However, a pre-created Key Signing Key must be provided while creating the root zone. This pre-created key therefore becomes the root key. The name of the root zone is a name without name component.

\subsubsection{Zone Delegation}
There are three common cases of zone delegation.

First, the parent zone is the direct ancestor of the child zone and the child zone is not a leaf node. This should be the most common case. At this case, user needs to first output the self-signed certificate of the Key Signing Key of the child zone by using ndns-export-certificate. Then, user can add the exported self-signed certificate into parent zone's NDNS database by using ndns-add-rr-from-file. Finally, user must add a resource record set by using ndns-add-rr with label = name components of child zone after parent zone's name, type = NS, and content-type = resp.

Second, the parent zone is the direct ancestor of the child zone and the child zone is a leaf node. In this case, the first two steps are identical with the first case. The only difference is at the last step. User now needs to add a resource record set with label = name components of child zone after parent zone's name, type = TXT, and content-type = resp.

Third, the parent zone is not the direct ancestor of the child zone. In this case, user first need to follow the procedures described above depending on whether the child zone is a leaf node or not. After that, user has to add resource record sets of which label = name components of middle layer zone after parent zone's name, type = NS, and content-type = auth for every middle layer zone between the parent zone and child zone.


%%% Local Variables:
%%% mode: latex
%%% TeX-master: "main"
%%% End: